﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 泛型字典01
{
    class Program
    {
        static void Main(string[] args)
        {
            Dictionary<int, string> stuInfo = new Dictionary<int, string>();
            stuInfo.Add(1001, "xiaoming");
            stuInfo.Add(1002, "xiaohoong");

            int i = stuInfo.Count;
            Console.WriteLine(i);

            stuInfo[1001] = "laowang";
            Console.WriteLine(stuInfo[1001]);

            Student s1 = new Student(101, "xiaoming", 60);
            Student s2 = new Student(102, "xiaoliang", 80);

            //Student s1 = new Student();
            //s1.ID = 101;
            //s1.Name = "xiaoming";
            //s1.Score = 60;

            Dictionary<int, Student> stuDicInfo = new Dictionary<int, Student>();
            stuDicInfo.Add(s1.ID, s1);
            stuDicInfo.Add(s2.ID, s2);

            stuDicInfo[s1.ID].Address = "QingDao";
            Console.WriteLine(s1.Address);
        }
    }

    class Student
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public float Score { get; set; }
        public string Address { get; set; }

        public Student(int id, string name, float score)
        {
            ID = id;
            Name = name;
            Score = score;
        }
    }
}
